<template>
  <div class="app-container">
    <!-- 类型管理新增 -->
    <h5 class="titleInfo">基础信息</h5>
    <el-form ref="form"  :inline="true" :model="form" label-width="150px">
      <el-row>
        <el-col :span="12">
          <el-form-item label="姓名">
            <span>{{form.realname}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="手机号">
            <span>{{form.username}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="地区">
            <span>{{form.area}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="审核状态">
            <span>{{form.status}}</span>
          </el-form-item>
        </el-col>
      </el-row>
      <!-- 认购信息 -->
      <div class="divBar"></div>
      <h5 class="titleInfo">认购信息</h5>
      <el-row>
        <el-col :span="12">
          <el-form-item label="认购分公司">
            <span>{{form.subscriptionName}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="认购金额">
            <span>{{form.subscriptionAmount}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="认购方式">
            <span>{{form.signType}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="是否回款">
            <span>{{form.returnMoney}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="推荐渠道">
            <span>{{form.recommendName}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="回款备注">
            <span>{{form.returnRemark}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="合同">
            <!-- {{form.contractImg}} -->
            <div style="display: flex;flex-flow: wrap;">
              <a
                v-for="(item, index) in contractImg"
                :key="index"
                style="margin: 0 10px;text-decoration: underline;color: blue;"
                :href="item.url"
                target="_blank"
                rel="noopener noreferrer"
              >{{ item.name }}</a>
            </div>
            <!-- <newUpload
              disabled
              ref="contractImg"
              :file-list="contractImg"
              :file-num="5"
              accept="jpeg、JPG、jpg、png"
            />-->
          </el-form-item>
        </el-col>
      </el-row>
      <!-- 考核信息 -->
      <div class="divBar"></div>
      <h5 class="titleInfo">考核信息</h5>
      <el-row>
        <el-col :span="12">
          <el-form-item label="生效时间">
            <span>{{form.examineTime}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="考核截止时间">
            <span>{{form.assessmentTime}}</span>
          </el-form-item>
        </el-col>
        <el-col :span="12">
          <el-form-item label="累计推荐门店数">
            <span>{{form.directServerCount}}</span>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
  </div>
</template>
<script>
// import newUpload from "@/components/imgUpload/shopImgUp";
import newUpload from "@/components/imgUpload/index";
import { regionDropDown } from "@/api/area";
import { getInfo } from "@/api/LCadministration";
export default {
  name: "LCadminInfo",
  filters: {},
  components: {
    newUpload
  },
  data() {
    return {
      form: {
        name: "",
        nick: "",
        managerName: "",
        managerPhone: "",
        province: null,
        city: null,
        foundingTime: "",
        contractImg: []
      },
      contractImg: [], // 合同图片URL
      options: [],
      selectedOptions: [],
      ProjectClass: []
    };
  },
  mounted() {
    this.form.id = this.$route.query.id;
    this.detail();
  },
  methods: {
    //详情
    detail() {
      const datas = { id: this.form.id };
      // console.log(datas);
      getInfo(datas).then(res => {
        // console.log(res);
        this.form = res.data.data;
        // if (res.data.data.contractImg) {
        //   this.contractImg = [
        //     {
        //       url:
        //         localStorage.getItem("imgUrlPrefix") +
        //         res.data.data.contractImg
        //     }
        //   ];
        // }
        // this.datafun(res);
        if (res.data.code == 0) {
          this.contractImg = res.data.data.contractImg
            ? this.imgsplit(res.data.data.contractImg)
            : [];
        }
      });
    },
    //     datafun(res) {
    // console.log(res)
    //       if (res.data.code == 0) {
    //         console.log(111)
    //         this.contractImg = res.data.data.contractImg
    //           ? this.imgsplit(res.data.data.contractImg)
    //           : [];
    //       }
    //     },
    imgsplit(arrstr) {
      if (arrstr.length > 1) {
        arrstr = arrstr.split(",");
      }
      for (let i = 0; i < arrstr.length; i++) {
        arrstr[i] = {
          url: localStorage.getItem("imgUrlPrefix") + arrstr[i],
          name: arrstr[i]
        };
      }

      return arrstr;
    }
  }
};
</script>

<style scoped>
.app-container {
  padding: 0px !important;
}
.form {
  margin-left: 268px;
}
.el-switch__label--left {
  margin-right: 0;
}
.el-switch__label.is-active {
  color: #409eff !important;
  width: 100%;
  text-align: center;
  display: inline-block;
}
</style>
